package com.changgou.order.feign;

import com.changgou.entity.Result;
import com.changgou.order.pojo.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;





import java.util.Map;


import java.util.List;


@FeignClient(name = "order")
public interface OrderFeign {

    @PostMapping("/order")
    public Result add(@RequestBody Order order);

    @GetMapping("/order/{id}")
    public Result<Order> findById(@PathVariable("id") String id);

    /**
     * 根据用户查询订单列表
     */
    @GetMapping("/order/list")
    public Result<List<Order>> list();

    /**
     * 取消订单
     */
    @RequestMapping("/order/closeOrder")
    public Result closeOrder(@RequestParam("orderId") String orderId);

    /**
     * 确认收货
     */
    @RequestMapping("/order/receipt")
    public Result receipt(@RequestParam("orderId") String orderId);

    @PostMapping(value = "/order/search/{page}/{size}" )
    public Result findPage(@RequestBody Map searchMap, @PathVariable("page")  int page, @PathVariable("size")  int size);

    /**
     * 查询未付款订单
     */
    @GetMapping("/order/findList2Pay")
    public Result<List<Order>> findList2Pay();

    //发货
    @PostMapping("/order/batchSend")
    public Result batchSend(@RequestBody List<Order> orders);

    /**
     * 查询未发货订单
     */
    @GetMapping("/order/findList2Send")
    public Result<List<Order>> findList2Send();

    /**
     * 查询未发货订单
     */
    @GetMapping("/order/findList2Receive")
    public Result<List<Order>> findList2Receive();

    /**
     * 查询未评价订单
     */
    @GetMapping("/order/findList2Evaluation")
    public Result<List<Order>> findList2Evaluation();

    /**
     * 评价订单
     */
    @GetMapping("/order/evaluation/{orderId}")
    public Result evaluation(@PathVariable("orderId")String orderId,@RequestParam("buyerRate") String buyerRate ,@RequestParam("evaluation") String evaluation);

    @DeleteMapping(value = "/order/{id}")
    public Result delete(@PathVariable("id") String id);

}
